home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / docdemos / xordemo.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2001-02-09  |  335 b   |  13 lines

  1. program XorDemo;
  2. var
  3.   a, b, c: Integer;
  4. begin
  5.   if (a = 0) xor (b = 0) then
  6.     c := 1  { happens if either `a' or `b' is zero,    }
  7.             { but not if both are zero or both nonzero }
  8.   else if a xor b = 0 then  { bitwise xor }
  9.     c := 2  { happens if a = b }
  10.   else
  11.     xor (c, a)  { same as `c := c xor a' }
  12. end.
  13.